package com.lwj.liwanjia.view.activity.personal;

import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.lwj.liwanjia.R;
import com.lwj.liwanjia.adapter.RegisterJiLuAdapter;
import com.lwj.liwanjia.base.BaseActivity;
import com.lwj.liwanjia.bean.RegisterJiLuBean;

import java.util.ArrayList;
import java.util.List;

/**
 * 分享后的注册界面
 * Created by 001 on 2017/9/11.
 */

public class YaoQingZhuCe extends BaseActivity implements View.OnClickListener {

    private TextView tv_back;
    private TextView tv_title;
    private ListView mListView;//注册记录的容器
    private RegisterJiLuAdapter jiLuAdapter;//注册记录的适配器
    private List<RegisterJiLuBean> jiLuList;//注册记录的数据集合

    @Override
    protected void initView() {

        tv_back = (TextView) findViewById(R.id.tv_left);
        tv_title = (TextView) findViewById(R.id.tv_title);
        mListView = (ListView) findViewById(R.id.listView);

        tv_back.setVisibility(View.VISIBLE);
        tv_title.setVisibility(View.VISIBLE);
        tv_title.setText("邀请有礼");

        tv_back.setOnClickListener(this);

    }

    @Override
    protected void initData() {

        //假数据,适配器
        initJiLu();
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_yao_qing_zhu_ce;
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            //返回
            case R.id.tv_left:
                finish();
                break;
        }
    }

    //假数据,适配器
    private void initJiLu() {

        jiLuList = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            RegisterJiLuBean bean = new RegisterJiLuBean();
            bean.name = "谢明";
            bean.time = "2017.09.15";
            bean.phone = "15663324589";
            jiLuList.add(bean);
            RegisterJiLuBean bean01 = new RegisterJiLuBean();
            bean01.name = "旺平";
            bean01.time = "2017.09.15";
            bean01.phone = "16763324589";
            jiLuList.add(bean01);
            RegisterJiLuBean bean02 = new RegisterJiLuBean();
            bean02.name = "于总";
            bean02.time = "2017.09.15";
            bean02.phone = "18963324589";
            jiLuList.add(bean02);
        }

        jiLuAdapter = new RegisterJiLuAdapter(YaoQingZhuCe.this, jiLuList);
        mListView.setAdapter(jiLuAdapter);
    }
}
